let xsp_fn = {
  //增
  api_add(sql_table_name) {
    let obj = {};
    obj.sql = `insert into ${sql_table_name} set ?`;
    obj.err = { code: 0, msg: "添加失败！" };
    obj.success = { code: 1, msg: "添加成功!" };
    return obj;
  },
  //删
  api_del(sql_table_name) {
    let obj = {};
    obj.sql = `delete from ${sql_table_name} where id=?`;
    obj.err = { code: 0, msg: "删除失败！" };
    obj.success = { code: 1, msg: "删除成功!" };
    return obj;
  },
  //改
  api_update(sql_table_name) {
    let obj = {};
    obj.sql = `update ${sql_table_name} set ? where id=?`;
    obj.err = { code: 0, msg: "修改失败！" };
    obj.success = { code: 1, msg: "修改成功!" };
    return obj;
  },
  //查
  api_sel(sql_table_name, pno = 1, pageSize = 10) {
    let start = (pno - 1) * pageSize;
    let obj = {};
    obj.sum_sql = `select * from ${sql_table_name}`;
    obj.page_sql = `select * from ${sql_table_name} limit ${start},${pageSize}`;
    obj.err = { code: 0, msg: "查询失败！" };
    obj.success = {
      code: 1,
      msg: "查询成功",
      pno,
      pageSize,
      pageCount,
      recordCount,
      data,
    };
    return obj;
  },
};
module.exports = xsp_fn;
